const base = 'cbv.aux.order';
const chat = 'chat.messages';

/**
 * 获取订单列表
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function search({ pg, search }) {
  return RSocket.rs({
    route: `${base}.search`,
    args: {
      pg: { ...pg },
      search: {
        ...search,
      },
    },
  });
}

/**
 * 获取订单数量
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function count({ search }) {
  return RSocket.rr({
    route: `${base}.search.count`,
    args: {
      search: {
        ...search,
      },
    },
  });
}

/**
 * 获取订单列表
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function search_chat({ pg, search }) {
  return RSocket.rs({
    route: `${chat}.search`,
    args: {
      pg: { ...pg },
      search: {
        ...search,
      },
    },
  });
}

/**
 * 获取订单数量
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function count_chat({ search }) {
  return RSocket.rr({
    route: `${chat}.count`,
    args: {
      search: {
        ...search,
      },
    },
  });
}

/**
 * 查询指定订单
 * @param {*} param0
 * @returns
 */
export function get(id) {
  return RSocket.rr({
    route: `${base}.${id}.search`,
  });
}

/**
 * 修改订单
 * @param {*} param0
 * @returns
 */
export function update(data) {
  return RSocket.rr({
    route: `${base}.update`,
    data: { ...data },
  });
}

/**
 * 取消已抢订单
 * @param {*} param0
 * @returns
 */
export function cancelOrder(id) {
  return RSocket.rr({
    route: `${base}.cancel.take.${id}`,
  });
}

/**
 * 日志流水分页条件查询
 * @param {}
 */
// eslint-disable-next-line no-shadow
export function getLogs({ search }) {
  return RSocket.rs({
    route: 'logs',
    args: {
      search,
      pg: { page: 0, size: 100, sort: ['ts;desc'] },
    },
  });
}

/**
 * 日志流水分页条件查询数量
 * @param {}
 */
// eslint-disable-next-line no-shadow
export function getLogsCount(search) {
  return RSocket.rr({
    route: 'logs.count',
    args: {
      search: {
        args: {
          updatePoint: 'true',
        },
        ...search,
      },
    },
  });
}

/**
 * 获取评价
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function getComments({ pg, search }) {
  return RSocket.rs({
    route: 'comments.group',
    args: {
      pg: { ...pg },
      search: {
        ...search,
      },
    },
  });
}

/**
 * 聊天房间
 * @returns
 */
export function getRooms(args) {
  return RSocket.rr({
    route: 'chat.rooms.by-biz-key',
    args: { ...args },
  });
}

/**
 * 取消订单
 * @returns
 */
export function cancelOrderIssue(orderId) {
  return RSocket.rr({
    route: `${base}.console.cancel.issue.${orderId}`,
  });
}

/**
 * 人工干预订单
 * @returns
 */
export function intervention(args) {
  return RSocket.rr({
    route: `${base}.intervention`,
    args: { ...args },
  });
}

/**
 * 查询用户列表
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function getMember(search) {
  return RSocket.rs({
    route: 'cbv.aux.member.search',
    args: {
      pg: {
        page: 0,
        size: 999,
        sort: ['crDate;desc'],
      },
      search: {
        ...search,
      },
    },
  });
}
